package org.snusmumr.android.media.bean;

public class ItemModel<E> implements Comparable<ItemModel<?>> {
	private Long id;
	private E value;
	
	public ItemModel(Long id, E value) {
		super();
		this.id = id;
		this.value = value;
	}

	public Long getId() {
		return id;
	}

	public E getValue() {
		return value;
	}
	
	public void setValue(E value) {
		this.value = value;
	}

	@Override
	public int compareTo(ItemModel<?> another) {
		Long otherId = another != null ? another.getId() : null;
		if(otherId == null)
			otherId = Long.MIN_VALUE;
		return this.id.compareTo(otherId);
	}
	
	@Override
	public String toString() {
		return "id: " + id + "; value: " + value;
	}
}
